<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/10
 * Time: 16:55
 */
include "status.php";
include  "config.php";

if($_SERVER["REQUEST_METHOD"]!="POST"){
    print_r(json_encode(Status::$reg_nget));
    return;
}
if(isset($_REQUEST["uname"]) && isset($_REQUEST["upwd"]) && isset($_REQUEST["uemail"]))
{
    $UEMAIL=$_REQUEST["uemail"];
    $UNAME=$_REQUEST["uname"];
    $UPWD=$_REQUEST["upwd"];
    $sql="INSERT INTO userinfo (u_email,u_name,u_pwd) VALUES (?,?,?);";
    $stmt=$conn->prepare($sql);
    $stmt->bind_param("sss",$UEMAIL,$UNAME,$UPWD);
    $stmt->execute();
//    print_r($stmt);
    if($stmt->affected_rows>=1)
    {
        print_r(json_encode(Status::$reg_success));
    }
    else{
        print_r(json_encode(Status::$reg_error));
    }
    $stmt->close();
    $conn->close();
}
else{
    print_r(json_encode(Status::$reg_nemp));
}